package com.example.spring.rabbitmq.comsumer;

import cn.hutool.json.JSONUtil;
import com.example.spring.rabbitmq.message.WorkOrderCreateMessageResp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * TODO
 *
 * @Description
 * @Author zhengmw
 * @Data 2024/5/15 20:27
 */
@Slf4j
@Component
public class RabbitmqConsumer {
    @RabbitListener(queuesToDeclare = @Queue("MQ.XUNTIAN.WORD_ORDER_RESULT_SETTLEMENT"))
    @RabbitHandler
    public void onMessage(String message) {
        WorkOrderCreateMessageResp messageResp = JSONUtil.toBean(message, WorkOrderCreateMessageResp.class);
        log.info("=======消费端：{}============", messageResp);
    }
}
